﻿

Public Class PanelSplitting

    'Fields :
    Private _LocalSplitting As New Splitting
    Private _TargetNode As ZipNode
    Public WriteOnly Property TargetNode As ZipNode
        Set(value As ZipNode)
            _TargetNode = value
            _LocalSplitting.CopyFrom(_TargetNode.ZipSettings.Splitting)
            ShowSplitting()
        End Set
    End Property
    'Show Splitting :
    Private Sub ShowSplitting()
        KNUD_DesiredSplitSize.Minimum = 65536
        KNUD_DesiredSplitSize.Maximum = _LocalSplitting.Size
        KL_Size_Value.Text = StringFromSize(_LocalSplitting.Size)
        KNUD_DesiredSplitSize.Value = _LocalSplitting.SplitSize
        KL_SplitSize.Text = StringFromSize(_LocalSplitting.SplitSize)
    End Sub
    'Splits Selection :
    Private Sub KNUD_DesiredSplitSize_ValueChanged(sender As System.Object, e As System.EventArgs) Handles KNUD_DesiredSplitSize.ValueChanged
        KL_SplitSize.Text = StringFromSize(CLng(KNUD_DesiredSplitSize.Value))
    End Sub
    'Actions :
    Public Sub Reset()
        _LocalSplitting.Reset()
        ShowSplitting()
    End Sub
    Public Sub Cancel()
        _LocalSplitting.CopyFrom(_TargetNode.ZipSettings.Splitting)
        ShowSplitting()
    End Sub
    Public Sub Apply()
        _TargetNode.ZipSettings.Splitting.SplitSize = CLng(KNUD_DesiredSplitSize.Value)
    End Sub

End Class
